package com.etc.admin.controller;

import com.etc.entity.FlashSale;
import com.etc.service.FlashSaleService;
import com.etc.utils.PageData;
import com.etc.vo.FlashSaleVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 文件名:com.etc.admin.controller.AdminFlashSaleController
 * 描述：管理员秒杀活动
 * 作者:吴仕泉
 * 时间:2019/5/29 13:06
 */
@Controller
@RequestMapping("adminflashsale.action")
public class AdminFlashSaleController {

    @Autowired
    FlashSaleService flashSaleService;

    //后台管理员界面，活动列表分页展示
    @RequestMapping("flashsalepage")
    @ResponseBody
    public PageData<FlashSaleVo> flashSalePage(Integer page, Integer limit){
        if(page<0||limit<0){
            return null;
        }
        if(page == 0){
            page = 1;
        }
        if(limit==0){
            limit = 10;
        }

        PageData<FlashSaleVo> pd =flashSaleService.selectFlashSaleByPage(limit,page);

        if(pd == null){
            return null;
        }
        pd.setCode(0);

        return pd;
    }


}
